UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bFr/M7YDVkZqQmilTLQNIcf8rvI/eb2M2cT8EvzZOb8=' 
WHERE 
  key_id = '5e05a973ef3acb9dad23435497852521d0662f287b0c73ce2fb214a3d00b3a6b' 
  AND (
    token = 'bFr/M7YDVkZqQmilTLQNIcf8rvI/eb2M2cT8EvzZOb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041