UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HYBULC5OXZlkaLHargN2u3aRpzsHJWGZPiFR+WXVmEE=' 
WHERE 
  key_id = 'e1e6dbd944d94c78b0280949a10688ea3853636a8fa348cca8114f505fdacd20' 
  AND (
    token = 'HYBULC5OXZlkaLHargN2u3aRpzsHJWGZPiFR+WXVmEE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032