UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yhgw2Xvtvjhn+LtM/y2vyR7buhFO4rb+Lzj7tvrz6d0=' 
WHERE 
  key_id = '9b4adb53ec89f46e2ef55886af91668acc36f67275348fbceaabd409e8a67838' 
  AND (
    token = 'Yhgw2Xvtvjhn+LtM/y2vyR7buhFO4rb+Lzj7tvrz6d0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027