UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Znq21C+5u/nkVFIa/c8v29guFOHm5vXn2gH9hthshos=' 
WHERE 
  key_id = '5b17becd7cc2b5b3adf3ffe7ed32018fd646bb9e900358a4f137d4de4153700e' 
  AND (
    token = 'Znq21C+5u/nkVFIa/c8v29guFOHm5vXn2gH9hthshos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051