UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mSwkL/HYIQUg9Z8U3ElOSnjSMCqcAxNXy1D7EWgxMG4=' 
WHERE 
  key_id = '6cf19b1f9a678b502750911d7242295f49c09f82afc12b6d6b0aa644e7d17d49' 
  AND (
    token = 'mSwkL/HYIQUg9Z8U3ElOSnjSMCqcAxNXy1D7EWgxMG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018