UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KVvjgJRWk5DhC16vgNrM1kEUIY3UhVr3iqlzxBB0zaA=' 
WHERE 
  key_id = '47c7a0ff69f948e9baa4bbc4f6141fa1c0a867fd0046643c0ea6f4a6a9890807' 
  AND (
    token = 'KVvjgJRWk5DhC16vgNrM1kEUIY3UhVr3iqlzxBB0zaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035