UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BwTUsmmuMNDU0Bwlqs7XZNa5KGeS2fadO8d42Ty3eBA=' 
WHERE 
  key_id = 'aa2edb46c93bca6cf9e877948d844f87e98249fa5c920bb4a4bd2ad338b146a4' 
  AND (
    token = 'BwTUsmmuMNDU0Bwlqs7XZNa5KGeS2fadO8d42Ty3eBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030