UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iZcToHi7v+7iNf2OXq1xb6jtkBtTCoVoxKL13sLutog=' 
WHERE 
  key_id = '22010555711d28b911d28890400998985048c729477497a939efb1b894ac6658' 
  AND (
    token = 'iZcToHi7v+7iNf2OXq1xb6jtkBtTCoVoxKL13sLutog=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025