UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JE3C6n70JZRbvjudBjZzZc5Ni2OMu95zYolUflwhvzw=' 
WHERE 
  key_id = '6e6718b2630145aec82c706be94e2d88c11857750b7ad575677ee0221bcea861' 
  AND (
    token = 'JE3C6n70JZRbvjudBjZzZc5Ni2OMu95zYolUflwhvzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016