UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AcwFVxpZAnSe4fIqfgfJpDu3gh2Vtz3ySgGaJ7KJG8g=' 
WHERE 
  key_id = '4038e4efdd6945df846552fe479dc773a40d00b4549c48d628c5d2d688e18109' 
  AND (
    token = 'AcwFVxpZAnSe4fIqfgfJpDu3gh2Vtz3ySgGaJ7KJG8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036