UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IncYqXZ49PnVG8BbCFMc0+tsNLbdD0Uf76+jjyJ3Mls=' 
WHERE 
  key_id = '17d368a07bbe4556dda641a11a404f8d35a9a9d7cb963d8370f7ba99884ff6a4' 
  AND (
    token = 'IncYqXZ49PnVG8BbCFMc0+tsNLbdD0Uf76+jjyJ3Mls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017