UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k3bznmq5BLr5jrQU2gXWOvUeFZ+irxBwzara2O9y3Ps=' 
WHERE 
  key_id = 'a376b754edebf25de6e293634d435345683bfd29454e0de30a0e4df849e2c677' 
  AND (
    token = 'k3bznmq5BLr5jrQU2gXWOvUeFZ+irxBwzara2O9y3Ps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032