UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v3VfFJfILPKPuV8DCmrU7SCz/Clnus+3pQcEf8WTyto=' 
WHERE 
  key_id = '447d5d74cc74532c858b2aa5b830d018d16640c5cabd47a03ce043e8f1654ed9' 
  AND (
    token = 'v3VfFJfILPKPuV8DCmrU7SCz/Clnus+3pQcEf8WTyto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035