UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7LGNDPPt39A2BTT+bT2RRZLDitUWBs3r86VYqcjRohA=' 
WHERE 
  key_id = 'a6c77b82da80392dbfefe6ba80a213ae372033c2ca395778a29bb3c45bf92c49' 
  AND (
    token = '7LGNDPPt39A2BTT+bT2RRZLDitUWBs3r86VYqcjRohA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023