UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9pvA9+4Tm1Hr+NEY+odjwfYSgqRlMhQhgFnsIP/FvoI=' 
WHERE 
  key_id = 'd8a843d33c919872ac6e9525f7acc7f3531152c617f5fe91efebe2003b0a39fe' 
  AND (
    token = '9pvA9+4Tm1Hr+NEY+odjwfYSgqRlMhQhgFnsIP/FvoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033