UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NaXogp1ynAvtQpqNM4hJGESVfhKNZK1LlVAoHdC6jC0=' 
WHERE 
  key_id = 'd1d549ef0c85756c2a33df6b95696177911e14f84e016160673032bccd964545' 
  AND (
    token = 'NaXogp1ynAvtQpqNM4hJGESVfhKNZK1LlVAoHdC6jC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021