UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IqfB5uNzorc87181o1QV66e5tDWrKYaZb7XVk9mvsRY=' 
WHERE 
  key_id = '565c1877c51575ab3aba5391f8502f040f878d071efd821e539349d0f431355b' 
  AND (
    token = 'IqfB5uNzorc87181o1QV66e5tDWrKYaZb7XVk9mvsRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044