UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9+H10pFENQQJgQo+gHXqBETyncFR8omtdYkvAxwRsis=' 
WHERE 
  key_id = '97712287f4a587afe40d4505162e38097c3585826fc475efecd153ad1fac7ad5' 
  AND (
    token = '9+H10pFENQQJgQo+gHXqBETyncFR8omtdYkvAxwRsis=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037