UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JN1xVby6gpqzjJfVzcf5N3Fzy3AEI3GcjdzFcXpzOAU=' 
WHERE 
  key_id = 'b6f2f4f4dfbf66b6eaa54a3896523052a11345964c3eca690b8b2feeb4ad70d2' 
  AND (
    token = 'JN1xVby6gpqzjJfVzcf5N3Fzy3AEI3GcjdzFcXpzOAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051