UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OK5gu2oEHrAObqHh+UMNQ/wq2uUTEQy9BxWkYCZkS28=' 
WHERE 
  key_id = '3aadf913212e243a20cbd747904079cd570e8f4764a588f144ff1afb1ad62780' 
  AND (
    token = 'OK5gu2oEHrAObqHh+UMNQ/wq2uUTEQy9BxWkYCZkS28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044