UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xFDmKOpsTMqB5dmNiLtLsnY3mO5Xxd1sWlhS8e/Spwo=' 
WHERE 
  key_id = '9716539c1f595b34bff73337d3774cea14005b61992a2ed0fff89c929a450a83' 
  AND (
    token = 'xFDmKOpsTMqB5dmNiLtLsnY3mO5Xxd1sWlhS8e/Spwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024