UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dhJCKysn1O60iSPtB4hg8Wg4hyiK1c1NxFU5rZ38VDE=' 
WHERE 
  key_id = '3885c72dd16c5e42bc8545c68ba8f5fb8edd90fb1f1d477d4758d293973ef35a' 
  AND (
    token = 'dhJCKysn1O60iSPtB4hg8Wg4hyiK1c1NxFU5rZ38VDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033