UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y/qSPSqLm7QO9fNGTaRZLi57LkyadCJLgA2H/KC9afU=' 
WHERE 
  key_id = '9465e041487ad87ffba4124ed8ca94c28bf980a3215b6acf8b8f9370442417c8' 
  AND (
    token = 'y/qSPSqLm7QO9fNGTaRZLi57LkyadCJLgA2H/KC9afU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043