UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hAyeDOTt988H+q911VvkQOcfRZ7lOYutLGMOxG3DHtU=' 
WHERE 
  key_id = 'f4a42bf4c8c568c94edd42db3939c475ece39f497e08f1af8820ef811f2f3a3a' 
  AND (
    token = 'hAyeDOTt988H+q911VvkQOcfRZ7lOYutLGMOxG3DHtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037