UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XQo7GA4PV/pO05BSxJBuzPY0+gpC2flr71GxI7OyV28=' 
WHERE 
  key_id = 'bfd72eb84ff0a7fa35cefd6534fecd4845df3453743c2b88670508172f1dff58' 
  AND (
    token = 'XQo7GA4PV/pO05BSxJBuzPY0+gpC2flr71GxI7OyV28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025