UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9RmiDgNLiO4eXBGjC67RUxOw4NOdgTrU+rUL07IvGmU=' 
WHERE 
  key_id = 'f5f4412a8903f72dc9eb215266a0b0afa363c6550750a78591d14ba5e508e909' 
  AND (
    token = '9RmiDgNLiO4eXBGjC67RUxOw4NOdgTrU+rUL07IvGmU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055