UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ivvym5FsxkMoFjFsM1xsj3T5xtHMCSOBoKMeD+4oYXA=' 
WHERE 
  key_id = '248215207274382790c7687ed0d1e34c42208ecaf470590fc06eba11502f69b3' 
  AND (
    token = 'ivvym5FsxkMoFjFsM1xsj3T5xtHMCSOBoKMeD+4oYXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027