UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GXF7NQ+DNg7sS6C4T33cj11MJfk1q8HbY1BGNRrqx7Y=' 
WHERE 
  key_id = '4ce44689673abfd8685eced2383a85c3694586753b99ab5e7002f65e21494477' 
  AND (
    token = 'GXF7NQ+DNg7sS6C4T33cj11MJfk1q8HbY1BGNRrqx7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031