UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uXLIXnB43Cz1cRacczGx0EibScZOUOoxUrOkI/tANf8=' 
WHERE 
  key_id = '2e50f544c6a97a4383806abe8c63789e9b5c175be107033be3e52818d359b16e' 
  AND (
    token = 'uXLIXnB43Cz1cRacczGx0EibScZOUOoxUrOkI/tANf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025