UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mgPwTou4PaPrN8JywE5s1vHWmzmTmQ4d7KhPHM4no68=' 
WHERE 
  key_id = '6fc870a7af701bad9785360ff2c8953516543b2033ea43f714f940bf3c1efccf' 
  AND (
    token = 'mgPwTou4PaPrN8JywE5s1vHWmzmTmQ4d7KhPHM4no68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032