UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm3baM03oeG7pLNzTBJaIwRiX69+AISM7pIXQ5FPh9UQ=' 
WHERE 
  key_id = '1896b6c5f3eac29bb9eb51f466ac900609a8e456f824dfb16eca126da1989b12' 
  AND (
    token = 'm3baM03oeG7pLNzTBJaIwRiX69+AISM7pIXQ5FPh9UQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039