UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rCe6Iyq1ehsJkCvb0lJD2SCIOnI+Gwnus8K1mTUEz2I=' 
WHERE 
  key_id = '345fcd0772a7efbe9171a48b571bfa95c47527e30b1c5ed355bac2ec48962058' 
  AND (
    token = 'rCe6Iyq1ehsJkCvb0lJD2SCIOnI+Gwnus8K1mTUEz2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033