UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H1A/FWIG3gSXAbGV21jtUQH50uCg4GevN7ya0+hTNIs=' 
WHERE 
  key_id = '99ae74301a0d19a0a0f384a27afe3e0ef90380f6237dbb8eab9f749c6c66ca1e' 
  AND (
    token = 'H1A/FWIG3gSXAbGV21jtUQH50uCg4GevN7ya0+hTNIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016