UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2g8myKkHXOrAJCf5dOGgQ8FxCcR8X2CjChhR8+PMMdY=' 
WHERE 
  key_id = 'c67c60756d7d085f63d4d160c574bec7bf50f77c3136801554d62b74410a3955' 
  AND (
    token = '2g8myKkHXOrAJCf5dOGgQ8FxCcR8X2CjChhR8+PMMdY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036