UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7XyCnQsVb4dmWrtvT3+szDFpi/2xl1A9euuFiVaZZ9k=' 
WHERE 
  key_id = '8ebfb2c400223a2f5fd8571e991c3a98cc57718add874e77db9d0dcb75357a58' 
  AND (
    token = '7XyCnQsVb4dmWrtvT3+szDFpi/2xl1A9euuFiVaZZ9k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047