UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AOjQ/YTNNnk//3MWS1vlwMT2YC/q+nXWamddul0wALA=' 
WHERE 
  key_id = '8dd89fa619fa27fd1e17e48a9c3fac1405bc63da1ab592351f3ea46e37fa9366' 
  AND (
    token = 'AOjQ/YTNNnk//3MWS1vlwMT2YC/q+nXWamddul0wALA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028