UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/ckthGZaqdenUTyt17lByfayv7w3nIjG4DXRogj+Nx8=' 
WHERE 
  key_id = '2019e0829a689ee644158b17529246760fcdbc6b9e0e7a16faa59049dd029ada' 
  AND (
    token = '/ckthGZaqdenUTyt17lByfayv7w3nIjG4DXRogj+Nx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028