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

Query time 0.00022