UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BGl5H0r4HZNRATgN1Hdv5jhtXPXxxWYI5yuvHr1ksqY=' 
WHERE 
  key_id = '74b47b72fbca51a7b8b88f3e551f2f435217a263398b8a2f8084cb25dd8245cc' 
  AND (
    token = 'BGl5H0r4HZNRATgN1Hdv5jhtXPXxxWYI5yuvHr1ksqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026