UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c1pIJS2+Nfu48zSNepQAkOzbIsqy56MTB4marsov08g=' 
WHERE 
  key_id = '2b59009239c0ac0977862410de1b06e1a8b099572c6d13abc54480cf152a5382' 
  AND (
    token = 'c1pIJS2+Nfu48zSNepQAkOzbIsqy56MTB4marsov08g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032